package com.ls.fw.office.itext.itext.handler;

import com.lowagie.text.Document;
import com.lowagie.text.rtf.RtfWriter2;

public class WordHandler implements IWordHandler{
    
	private RtfWriter2 writer = null;
    private IHandler handler = null;
	
	public WordHandler(IHandler handler){
	    this.handler = handler;
	    writer = RtfWriter2.getInstance(handler.getDocument(), handler.getOut());
	    this.handler.open();
	}
	
 
	public Document getDocument(){
		return handler.getDocument();
	}

	@Override
	public RtfWriter2 getWriter() {
		return writer;
	}

	public IHandler getHandler() {
		return handler;
	}

	public void setHandler(IHandler handler) {
		this.handler = handler;
	}

	@Override
	public void close() {
		this.handler.close();
		if(this.writer!=null){
			this.writer.close();
		}
	}

}
